let jwt = require('jsonwebtoken');
let { expressjwt } = require('express-jwt');
let secretKey = 'chunjie';
let token = {
    //验证方法,参数是不需要验证的的接口列表
    yan(arr){
        // return (req,res,next)=>{
            return expressjwt({
                secret:secretKey,
                algorithms:['HS256']
            }).unless({
                path:arr
            })
        // }
    },
    //设置方法
    set(obj,time){
        let token = jwt.sign( obj,secretKey,{expiresIn:time} );
        return token;
    }
};
module.exports =token;